home *** CD-ROM | disk | FTP | other *** search
/ Garbo / Garbo.cdr / mac / hypercrd / hc2_x / tcprogud.sit / TC Prog Guide / card_59314.txt < prev    next >
Text File  |  1991-02-27  |  2KB  |  32 lines

  1. -- card: 59314 from stack: in
  2. -- bmap block id: 0
  3. -- flags: 0000
  4. -- background id: 4755
  5. -- name: 
  6.  
  7.  
  8. -- part contents for background part 4
  9. ----- text -----
  10. TC OBJECT EXTENSIONS
  11.  
  12. Think C 4.0 extends ANSI C with a few C++ features, as detailed in Chapter 4.  Most importantly, the definition of a 'struct' user-defined type may contain function prototypes, in which case the structure is called a "class".  These "member functions"   (or "methods") may refer directly to variables which are members of the same class; that is, these "instance" variables are said to have "class scope".  (Unlike C++, the name of a class may itself be assigned to a void pointer variable or passed to a function.*)
  13.  
  14. When a pointer to a variable of the class type is declared, the 'struct' keyword is not required, and the variable is called an "object".  Space for this variable is allocated dynamically using the new() function.  The member functions associated with this object may be accessed via the pointer using the '->' operator, which is termed                "sending a message to the object".  The variable is deallocated using the delete() function.
  15.  
  16. New classes can be defined which are "derived" from existing classes.  The derived classes "inherit" all the instance variables and methods of the base class, and may add 
  17.  
  18. -- part contents for background part 7
  19. ----- text -----
  20. 216
  21.  
  22. -- part contents for background part 29
  23. ----- text -----
  24. 6547
  25.  
  26. -- part contents for background part 27
  27. ----- text -----
  28. Alternative new() function
  29.  
  30. -- part contents for background part 20
  31. ----- text -----
  32. Alternative new() function - p209